﻿#define _CRT_SECURE_NO_WARNINGS 1

#include"list.h"

namespace lt
{
	void test1()
	{
		list<int> lt1;
		lt1.push_back(1);
		lt1.push_back(2);
		lt1.push_back(3);
		lt1.push_back(4);

		list<int>::iterator it1 = lt1.begin();
		list<int>::iterator it2(it1);
		while (it2 != lt1.end())
		{
			//*it += 10;

			cout << *it2 << " ";
			++it2;
		}
		cout << endl;
	}

	void test2()
	{
		list<int> lt1;
		lt1.push_back(1);
		lt1.push_back(2);
		lt1.push_back(3);
		lt1.push_back(4);

		list<int>::const_iterator it = lt1.cbegin();
		while (it != lt1.cend())
		{
			//*it += 10;
			cout << *it << " ";
			it++;
		}
		cout << endl;

		//cout << lt1.size() << endl;
		//cout << lt1.empty() << endl;
		//cout << lt1.front() << endl;
		//cout << lt1.back() << endl;
	}

	void test3()
	{
		list<int> lt1;
		lt1.push_back(1);
		lt1.push_back(2);
		lt1.push_back(3);
		lt1.push_back(4);

		list<int>::iterator it1 = lt1.begin();
		while (it1 != lt1.end())
		{
			//*it += 10;

			cout << *it1 << " ";
			++it1;
		}
		cout << endl;

		lt1.insert(++lt1.begin(), 10);
		lt1.push_front(11);
		lt1.push_front(110);
		for (auto e : lt1)
		{
			cout << e << " ";
		}
		cout << endl;
		//lt1.erase(--lt1.end());
		//lt1.erase(--lt1.end());
		lt1.pop_front();
		lt1.pop_front();
		for (auto e : lt1)
		{
			cout << e << " ";
		}
		cout << endl;

	}

	void test4()
	{
		list<int> lt1 = { 1,23,4,5,67 };
		list<int> lt2 = { 32,45,76,23 };
		list<int> lt3 = lt1;
		lt1.swap(lt2);
		for (auto e : lt3)
		{
			cout << e << " ";
		}
		cout << endl;
	}

	void test5()
	{
		list<int> lt1 = { 1,32,54,65,87,99 };
		list<int>::reverse_iterator rit = lt1.rbegin();
		while (rit != lt1.rend())
		{
			cout << *rit << " ";
			rit++;
		}
		cout << endl;
		list<int> lt2(5, 2);
		for (auto& e : lt2)
		{
			cout << e << " ";
		}
		cout << endl;

	}

	void test6()
	{
		list<int> lt = { 1,2,3,4 };
		list<int>::iterator it = lt.begin();
		while (it != lt.end())
		{
			cout << *it << " ";
			it++;
		}
	}
}

int main()
{
	lt::test6();
 	return 0;
}

